import java.io.File;


public class TestA {
	
	public static void main(String[] args) throws Exception {
		
		
		
		String encoding = System.getProperty("file.encoding");
		System.out.println(encoding);

		//\u4e2d\u56fd
		String str = new String("中国".getBytes(),"GBK");
		System.out.println(str);
		System.out.println(new String(str.getBytes(),"UTF-8"));
		System.out.println(convert(str));
	}
	
	/** 
	* 将字符串转成unicode 
	* @param str 待转字符串 
	* @return unicode字符串 
	*/ 
	public static String convert(String str) 
	{ 
		str = (str == null ? "" : str); 
		String tmp; 
		StringBuffer sb = new StringBuffer(1000); 
		char c; 
		int i, j; 
		sb.setLength(0); 
		for (i = 0; i < str.length(); i++) 
		{ 
			c = str.charAt(i); 
			sb.append("\\u"); 
			j = (c >>>8); //取出高8位 
			tmp = Integer.toHexString(j); 
			if (tmp.length() == 1) 
				sb.append("0"); 
			sb.append(tmp); 
			j = (c & 0xFF); //取出低8位 
			tmp = Integer.toHexString(j); 
			if (tmp.length() == 1) 
				sb.append("0"); 
			sb.append(tmp); 

		} 
		return (new String(sb)); 
	} 
}
